package com.shop.entity;

import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * News entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "news", catalog = "myshop")
public class News implements java.io.Serializable {

	// Fields

	private Integer enId;
	private Product product;
	private String enTitle;
	private String enContent;
	private Timestamp enCreateTime;

	// Constructors

	/** default constructor */
	public News() {
	}

	/** full constructor */
	public News(Product product, String enTitle, String enContent,
			Timestamp enCreateTime) {
		this.product = product;
		this.enTitle = enTitle;
		this.enContent = enContent;
		this.enCreateTime = enCreateTime;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "en_id", unique = true, nullable = false)
	public Integer getEnId() {
		return this.enId;
	}

	public void setEnId(Integer enId) {
		this.enId = enId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ep_id")
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Column(name = "en_title", length = 40)
	public String getEnTitle() {
		return this.enTitle;
	}

	public void setEnTitle(String enTitle) {
		this.enTitle = enTitle;
	}

	@Column(name = "en_content", length = 1000)
	public String getEnContent() {
		return this.enContent;
	}

	public void setEnContent(String enContent) {
		this.enContent = enContent;
	}

	@Column(name = "en_create_time", length = 19)
	public Timestamp getEnCreateTime() {
		return this.enCreateTime;
	}

	public void setEnCreateTime(Timestamp enCreateTime) {
		this.enCreateTime = enCreateTime;
	}

}